#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <Qobject>
#include <QDebug>
#include <QFile>
#include <QMessageBox>
#include <QCloseEvent>
#include <QList>
#include <QShortcut>
#include <QTextEdit>
#include <QTextBlock>
#include "wheelzoomfontsize.h"
#include <QLineEdit>
#include <QDialog>

QT_BEGIN_NAMESPACE
namespace Ui {
class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    QFile file;
    Widget(QWidget *parent = nullptr);
    ~Widget();

protected:
    bool eventFilter(QObject *obj, QEvent *event) override;

signals:
    // void mysignal(int value);
    void callDialogFind(const QString &selectedText);

private slots:
    void handleBtnOpenClicked();
    void handleBtnCloseClicked();
    // void handleMysignal(int value);
    void on_btnSave_clicked();
    void myBtnSave();
    void myBtnSaveAs();
    void on_comboBox_currentIndexChanged();
    void handleCursorPositionChanged();
    void handleShortcutZoomIn();
    void handleShortcutZoomOut();
    void handleShortcutZoomdef();
    void handleShortcutCheck();
    void showFindText(QString selectedText);
    void handleBtnfindNext();

private:
    Ui::Widget *ui;
    QString currentFilePath;
    bool isTextModified = false;
    int fontDefaultSize;
    QTextCursor lastCursor;


    QLineEdit *findLineEdit;
    QDialog *findDlg;

protected:
    void contextChanged()
    {
        isTextModified = true;
    }
};

#endif // WIDGET_H
